# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-libarchive
pkgname=('python2-libarchive' 'python-libarchive')
_pkgname=libarchive
pkgver=0.4.7
pkgrel=7
pkgdesc='Python adapter for universal, libarchive-based archive access.'
arch=('any')
url='https://pypi.python.org/pypi/libarchive/'
license=('GPL2')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/libarchive-0.4.7.tar.gz")
sha512sums=('385a4e6f78256342d50f9209f7a8cc556bbe010cf6c6b72899143cfc2d76eaca767aa2f55fdfdcb8dab651c2759b5027a543960a4c5418d9cf215962b5d6ceea')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-libarchive() {
  depends=('python2' 'python2-nose')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-libarchive() {
  depends=('python' 'python-nose')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

